package net.zjitc.utils;

import com.mchange.v2.c3p0.ComboPooledDataSource;


import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * @Author admin
 * @Date 2019/2/25 9:48
 */
public class C3P0Utils {
    private static DataSource dataSource = null;
    static {
        ComboPooledDataSource ds = new ComboPooledDataSource("exam");
        dataSource = ds;
    }

    public static Connection getConnection(){
        try {
            return dataSource.getConnection();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
    public static  DataSource getDataSource(){
        return dataSource;
    }
}
